/**
 * 
 */
package com.yidin.lsc;

import java.util.ArrayList;
import java.util.List;

import com.yidin.lsc.AddressListAdapter.ViewHolder;
import com.yidin.lsc.Blinddate.BlindDateList;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

/**
 * 大小圈相亲
 * @author cola
 *
 */
public class BlindDateAdapter extends BaseAdapter{
	private Context context;
	private View view;
	private List<BlindDateList> userInfos;
	public BlindDateAdapter(Context context, List<BlindDateList> userInfos){
		this.context = context;
		this.userInfos = userInfos;
	}
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return userInfos.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return userInfos.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View view = convertView;

		ViewHolder holder = null;
		if (view == null) {
			view = LayoutInflater.from(context).inflate(
					R.layout.nearbyfriendsitem, null);

			holder = new ViewHolder();
			view.setTag(holder);
			holder.tv_catalog = (TextView) view.findViewById(R.id.blindName);
			holder.tv_nick = (TextView) view.findViewById(R.id.blindContent);
			holder.tv_status = (TextView) view.findViewById(R.id.dis);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.tv_catalog.setText(userInfos.get(position).name);
		holder.tv_nick.setText(userInfos.get(position).status);
		holder.tv_status.setText(userInfos.get(position).introduce);
		return view;
	}

	class ViewHolder {

		TextView tv_catalog;
		TextView tv_nick;
		TextView tv_status;
		ImageView icon;
	}
}
